<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>选取地区</title>
<link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/list.js"></script>
<script type="text/javascript">
$().ready(function() {

	var $delete = $("#listTable a.delete");
	
	[@flash_message /]
	
	// 删除
	$(".data_back").click(function() {
		var $this = $(this);
		$.dialog({
			type: "warn",
			content: "${message("确认选取该地区吗?")}",
			onOk: function() {
                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                parent.$("input[name='areaId']").val($this.attr("href"));
                parent.$("input[name='areaName']").val($this.attr("accesskey"));
                parent.$("input[name='area.id']").val($this.attr("href"));
                parent.$("input[name='area.name']").val($this.attr("accesskey"));
                parent.layer.close(index);
                return false;
			}
		});
		return false;
	});
	
});
</script>
</head>
<body>
<div class="path">
    <a href="${base}/common/index">首页</a> &raquo;地区列表
</div>
	<div class="bar">
		<a href="add[#if parent??]?parentId=${parent.id}[/#if]" class="iconButton">
			<span class="addIcon">&nbsp;</span>添加
		</a>
		[#if parent??]
			<div class="pageBar">
				[#if parent.parent??]
					<a href="getArea?parentId=${parent.parent.id}" class="iconButton">
						<span class="upIcon">&nbsp;</span>${message("上级地区")}
					</a>
				[#else]
					<a href="getArea" class="iconButton">
						<span class="upIcon">&nbsp;</span>${message("上级地区")}
					</a>
				[/#if]
			</div>
		[/#if]
	</div>
	<table id="listTable" class="list">
		<tr>
			<th colspan="5" class="green" style="text-align: center;">
				[#if parent??]${message("上级地区")} - ${parent.name}[#else]${message("顶级地区")}[/#if]
			</th>
		</tr>
		[#list areas?chunk(5, "") as row]
			<tr>
				[#list row as area]
					[#if area?has_content]
						<td>
							<a href="getArea?parentId=${area.id}" title="${message("查看")}">${area.name}</a>
                            <a href="${area.id}" accesskey="${area.name}" class="data_back" title="${message("选取")}">[选取]</a>
						</td>
					[#else]
						<td>
							&nbsp;
						</td>
					[/#if]
				[/#list]
			</tr>
		[/#list]
		[#if !areas?has_content]
			<tr>
				<td colspan="5" style="text-align: center; color: red;">
					${message("没有内容了")} <a href="add.jhtml[#if parent??]?parentId=${parent.id}[/#if]" style="color: gray">${message("添加")}</a>
				</td>
			</tr>
		[/#if]
	</table>
</body>
</html>